

var spice_model_draw = {};
var MODEL = {};
var MODEL_base = {};

console.log("hello world!");

var nmos_data = [
[   130,0,0,0,29,0,0,0,
    129,0,0,0,30,0,0,0,
    127,0,0,0,30,0,0,0,
    127,0,0,0,31,0,0,0,
    126,0,0,0,32,0,0,0,126,0,0,0,37,0,0,0,130,0,0,0,41,0,0,0,130,0,0,0,71,0,0,0,128,0,0,0,73,0,0,0,128,0,0,0,78,0,0,0,130,0,0,0,80,0,0,0,130,0,0,0,102,0,0,0,129,0,0,0,103,0,0,0,98,0,0,0,103,0,0,0,96,0,0,0,101,0,0,0,96,0,0,0,95,0,0,0,95,0,0,0,95,0,0,0,94,0,0,0,96,0,0,0,94,0,0,0,121,0,0,0,94,0,0,0,96,0,0,0,95,0,0,0,95,0,0,0,96,0,0,0,96,0,0,0,96,0,0,0,102,0,0,0,97,0,0,0,102,0,0,0,98,0,0,0,103,0,0,0,130,0,0,0,103,0,0,0,131,0,0,0,104,0,0,0,130,0,0,0,105,0,0,0,96,0,0,0,105,0,0,0,96,0,0,0,122,0,0,0,96,0,0,0,106,0,0,0,97,0,0,0,105,0,0,0,130,0,0,0,105,0,0,0,131,0,0,0,104,0,0,0,132,0,0,0,104,0,0,0,132,0,0,0,80,0,0,0,133,0,0,0,79,0,0,0,134,0,0,0,79,0,0,0,134,0,0,0,78,0,0,0,135,0,0,0,77,0,0,0,168,0,0,0,77,0,0,0,169,0,0,0,78,0,0,0,169,0,0,0,136,0,0,0,168,0,0,0,137,0,0,0,163,0,0,0,137,0,0,0,162,0,0,0,138,0,0,0,162,0,0,0,139,0,0,0,167,0,0,0,139,0,0,0,168,0,0,0,140,0,0,0,168,0,0,0,141,0,0,0,167,0,0,0,142,0,0,0,167,0,0,0,143,0,0,0,166,0,0,0,144,0,0,0,166,0,0,0,145,0,0,0,164,0,0,0,147,0,0,0,164,0,0,0,148,0,0,0,163,0,0,0,149,0,0,0,163,0,0,0,150,0,0,0,162,0,0,0,151,0,0,0,162,0,0,0,153,0,0,0,167,0,0,0,153,0,0,0,169,0,0,0,155,0,0,0,169,0,0,0,216,0,0,0,168,0,0,0,217,0,0,0,136,0,0,0,217,0,0,0,133,0,0,0,214,0,0,0,133,0,0,0,186,0,0,0,134,0,0,0,185,0,0,0,134,0,0,0,184,0,0,0,135,0,0,0,183,0,0,0,135,0,0,0,180,0,0,0,133,0,0,0,178,0,0,0,133,0,0,0,145,0,0,0,132,0,0,0,144,0,0,0,113,0,0,0,144,0,0,0,112,0,0,0,143,0,0,0,112,0,0,0,138,0,0,0,110,0,0,0,136,0,0,0,108,0,0,0,138,0,0,0,107,0,0,0,138,0,0,0,106,0,0,0,139,0,0,0,105,0,0,0,139,0,0,0,103,0,0,0,141,0,0,0,102,0,0,0,141,0,0,0,101,0,0,0,142,0,0,0,100,0,0,0,142,0,0,0,99,0,0,0,143,0,0,0,98,0,0,0,143,0,0,0,98,0,0,0,145,0,0,0,97,0,0,0,146,0,0,0,96,0,0,0,146,0,0,0,96,0,0,0,157,0,0,0,95,0,0,0,158,0,0,0,94,0,0,0,157,0,0,0,94,0,0,0,132,0,0,0,94,0,0,0,157,0,0,0,95,0,0,0,158,0,0,0,96,0,0,0,158,0,0,0,96,0,0,0,147,0,0,0,97,0,0,0,146,0,0,0,98,0,0,0,146,0,0,0,99,0,0,0,147,0,0,0,100,0,0,0,147,0,0,0,102,0,0,0,149,0,0,0,103,0,0,0,149,0,0,0,104,0,0,0,150,0,0,0,105,0,0,0,150,0,0,0,107,0,0,0,152,0,0,0,108,0,0,0,152,0,0,0,109,0,0,0,153,0,0,0,111,0,0,0,153,0,0,0,112,0,0,0,152,0,0,0,112,0,0,0,147,0,0,0,113,0,0,0,146,0,0,0,130,0,0,0,146,0,0,0,131,0,0,0,147,0,0,0,131,0,0,0,178,0,0,0,128,0,0,0,181,0,0,0,98,0,0,0,181,0,0,0,96,0,0,0,179,0,0,0,96,0,0,0,168,0,0,0,96,0,0,0,180,0,0,0,97,0,0,0,181,0,0,0,129,0,0,0,181,0,0,0,131,0,0,0,179,0,0,0,131,0,0,0,146,0,0,0,112,0,0,0,146,0,0,0,112,0,0,0,152,0,0,0,111,0,0,0,153,0,0,0,110,0,0,0,153,0,0,0,109,0,0,0,152,0,0,0,108,0,0,0,152,0,0,0,106,0,0,0,150,0,0,0,105,0,0,0,150,0,0,0,104,0,0,0,149,0,0,0,103,0,0,0,149,0,0,0,101,0,0,0,147,0,0,0,100,0,0,0,147,0,0,0,98,0,0,0,145,0,0,0,98,0,0,0,144,0,0,0,99,0,0,0,143,0,0,0,100,0,0,0,143,0,0,0,101,0,0,0,142,0,0,0,102,0,0,0,142,0,0,0,103,0,0,0,141,0,0,0,104,0,0,0,141,0,0,0,106,0,0,0,139,0,0,0,107,0,0,0,139,0,0,0,108,0,0,0,138,0,0,0,109,0,0,0,138,0,0,0,110,0,0,0,137,0,0,0,111,0,0,0,137,0,0,0,112,0,0,0,138,0,0,0,112,0,0,0,144,0,0,0,132,0,0,0,144,0,0,0,133,0,0,0,145,0,0,0,133,0,0,0,179,0,0,0,135,0,0,0,181,0,0,0,135,0,0,0,183,0,0,0,133,0,0,0,185,0,0,0,133,0,0,0,215,0,0,0,135,0,0,0,217,0,0,0,168,0,0,0,217,0,0,0,169,0,0,0,216,0,0,0,169,0,0,0,155,0,0,0,170,0,0,0,154,0,0,0,171,0,0,0,155,0,0,0,171,0,0,0,217,0,0,0,170,0,0,0,218,0,0,0,171,0,0,0,218,0,0,0,171,0,0,0,155,0,0,0,173,0,0,0,153,0,0,0,178,0,0,0,153,0,0,0,178,0,0,0,151,0,0,0,177,0,0,0,150,0,0,0,177,0,0,0,149,0,0,0,176,0,0,0,148,0,0,0,176,0,0,0,147,0,0,0,174,0,0,0,145,0,0,0,174,0,0,0,144,0,0,0,173,0,0,0,143,0,0,0,173,0,0,0,142,0,0,0,172,0,0,0,141,0,0,0,172,0,0,0,140,0,0,0,173,0,0,0,139,0,0,0,178,0,0,0,139,0,0,0,178,0,0,0,138,0,0,0,177,0,0,0,137,0,0,0,172,0,0,0,137,0,0,0,171,0,0,0,136,0,0,0,171,0,0,0,75,0,0,0,136,0,0,0,75,0,0,0,132,0,0,0,71,0,0,0,132,0,0,0,41,0,0,0,136,0,0,0,37,0,0,0,136,0,0,0,32,0,0,0,134,0,0,0,30,0,0,0,133,0,0,0,30,0,0,0,132,0,0,0,29,0,0,0]
,[  94,0,0,0,169,0,0,0,
    94,0,0,0,194,0,0,0,
    95,0,0,0,195,0,0,0,
    96,0,0,0,195,0,0,0,
    96,0,0,0,184,0,0,0,
    97,0,0,0,183,0,0,0,
    128,0,0,0,183,0,0,0,
    131,0,0,0,186,0,0,0,
    131,0,0,0,213,0,0,0,
    129,0,0,0,215,0,0,0,
    129,0,0,0,220,0,0,0,
    131,0,0,0,222,0,0,0,
    131,0,0,0,248,0,0,0,
    130,0,0,0,249,0,0,0,
    129,0,0,0,249,0,0,0,
    127,0,0,0,251,0,0,0,
    127,0,0,0,253,0,0,0,
    126,0,0,0,254,0,0,0,
    127,0,0,0,255,0,0,0,
    127,0,0,0,1,1,0,0,
    129,0,0,0,3,1,0,0,
    135,0,0,0,3,1,0,0,
    136,0,0,0,2,1,0,0,
    136,0,0,0,1,1,0,0,
    137,0,0,0,0,1,0,0,
    137,0,0,0,253,0,0,0,
    136,0,0,0,252,0,0,0,
    136,0,0,0,250,0,0,0,
    135,0,0,0,250,0,0,0,
    133,0,0,0,248,0,0,0,
    133,0,0,0,221,0,0,0,
    135,0,0,0,219,0,0,0,
    168,0,0,0,219,0,0,0,
    134,0,0,0,219,0,0,0,
    133,0,0,0,220,0,0,0,
    133,0,0,0,249,0,0,0,
    134,0,0,0,249,0,0,0,
    136,0,0,0,251,0,0,0,
    136,0,0,0,252,0,0,0,
    135,0,0,0,253,0,0,0,
    133,0,0,0,251,0,0,0,
    130,0,0,0,251,0,0,0,
    129,0,0,0,252,0,0,0,
    129,0,0,0,253,0,0,0,
    128,0,0,0,254,0,0,0,
    127,0,0,0,253,0,0,0,
    127,0,0,0,251,0,0,0,
    129,0,0,0,249,0,0,0,
    131,0,0,0,249,0,0,0,
    131,0,0,0,221,0,0,0,
    129,0,0,0,219,0,0,0,
    129,0,0,0,216,0,0,0,
    131,0,0,0,214,0,0,0,
    131,0,0,0,185,0,0,0,
    129,0,0,0,183,0,0,0,
    96,0,0,0,183,0,0,0,
    96,0,0,0,194,0,0,0,
    95,0,0,0,195,0,0,0,
    94,0,0,0,194,0,0,0]
,[85,0,0,0,104,0,0,0,85,0,0,0,184,0,0,0,84,0,0,0,185,0,0,0,83,0,0,0,184,0,0,0,83,0,0,0,105,0,0,0,83,0,0,0,182,0,0,0,82,0,0,0,183,0,0,0,60,0,0,0,183,0,0,0,59,0,0,0,182,0,0,0,59,0,0,0,181,0,0,0,57,0,0,0,179,0,0,0,52,0,0,0,179,0,0,0,50,0,0,0,181,0,0,0,50,0,0,0,182,0,0,0,49,0,0,0,183,0,0,0,49,0,0,0,186,0,0,0,50,0,0,0,187,0,0,0,50,0,0,0,188,0,0,0,51,0,0,0,189,0,0,0,57,0,0,0,189,0,0,0,61,0,0,0,185,0,0,0,85,0,0,0,185,0,0,0]
];

var pmos_data = [
[121,0,0,0,30,0,0,0,120,0,0,0,31,0,0,0,119,0,0,0,31,0,0,0,119,0,0,0,33,0,0,0,118,0,0,0,34,0,0,0,118,0,0,0,37,0,0,0,120,0,0,0,39,0,0,0,121,0,0,0,39,0,0,0,122,0,0,0,40,0,0,0,122,0,0,0,67,0,0,0,120,0,0,0,69,0,0,0,120,0,0,0,73,0,0,0,122,0,0,0,75,0,0,0,122,0,0,0,94,0,0,0,121,0,0,0,95,0,0,0,94,0,0,0,95,0,0,0,93,0,0,0,94,0,0,0,93,0,0,0,95,0,0,0,122,0,0,0,95,0,0,0,122,0,0,0,75,0,0,0,123,0,0,0,74,0,0,0,124,0,0,0,75,0,0,0,124,0,0,0,96,0,0,0,124,0,0,0,75,0,0,0,127,0,0,0,72,0,0,0,155,0,0,0,72,0,0,0,156,0,0,0,73,0,0,0,156,0,0,0,121,0,0,0,155,0,0,0,122,0,0,0,150,0,0,0,122,0,0,0,150,0,0,0,124,0,0,0,151,0,0,0,125,0,0,0,151,0,0,0,126,0,0,0,152,0,0,0,127,0,0,0,152,0,0,0,128,0,0,0,154,0,0,0,130,0,0,0,154,0,0,0,131,0,0,0,155,0,0,0,132,0,0,0,155,0,0,0,133,0,0,0,156,0,0,0,134,0,0,0,155,0,0,0,135,0,0,0,150,0,0,0,135,0,0,0,150,0,0,0,136,0,0,0,151,0,0,0,137,0,0,0,155,0,0,0,137,0,0,0,156,0,0,0,138,0,0,0,156,0,0,0,194,0,0,0,155,0,0,0,195,0,0,0,127,0,0,0,195,0,0,0,125,0,0,0,193,0,0,0,124,0,0,0,193,0,0,0,122,0,0,0,191,0,0,0,122,0,0,0,169,0,0,0,123,0,0,0,168,0,0,0,125,0,0,0,168,0,0,0,125,0,0,0,167,0,0,0,126,0,0,0,166,0,0,0,126,0,0,0,163,0,0,0,125,0,0,0,162,0,0,0,125,0,0,0,161,0,0,0,125,0,0,0,163,0,0,0,126,0,0,0,164,0,0,0,126,0,0,0,165,0,0,0,125,0,0,0,166,0,0,0,125,0,0,0,167,0,0,0,124,0,0,0,168,0,0,0,123,0,0,0,168,0,0,0,122,0,0,0,167,0,0,0,122,0,0,0,166,0,0,0,121,0,0,0,165,0,0,0,93,0,0,0,165,0,0,0,93,0,0,0,166,0,0,0,94,0,0,0,165,0,0,0,120,0,0,0,165,0,0,0,122,0,0,0,167,0,0,0,122,0,0,0,191,0,0,0,123,0,0,0,192,0,0,0,121,0,0,0,194,0,0,0,121,0,0,0,198,0,0,0,123,0,0,0,200,0,0,0,122,0,0,0,201,0,0,0,122,0,0,0,223,0,0,0,121,0,0,0,224,0,0,0,120,0,0,0,224,0,0,0,120,0,0,0,225,0,0,0,119,0,0,0,226,0,0,0,119,0,0,0,231,0,0,0,120,0,0,0,232,0,0,0,122,0,0,0,232,0,0,0,123,0,0,0,233,0,0,0,124,0,0,0,233,0,0,0,125,0,0,0,232,0,0,0,127,0,0,0,232,0,0,0,128,0,0,0,231,0,0,0,128,0,0,0,226,0,0,0,127,0,0,0,225,0,0,0,127,0,0,0,224,0,0,0,126,0,0,0,224,0,0,0,125,0,0,0,223,0,0,0,123,0,0,0,223,0,0,0,122,0,0,0,222,0,0,0,122,0,0,0,201,0,0,0,124,0,0,0,199,0,0,0,125,0,0,0,199,0,0,0,127,0,0,0,197,0,0,0,158,0,0,0,197,0,0,0,158,0,0,0,138,0,0,0,159,0,0,0,137,0,0,0,164,0,0,0,137,0,0,0,165,0,0,0,136,0,0,0,165,0,0,0,135,0,0,0,160,0,0,0,135,0,0,0,159,0,0,0,134,0,0,0,159,0,0,0,133,0,0,0,160,0,0,0,132,0,0,0,160,0,0,0,131,0,0,0,162,0,0,0,129,0,0,0,162,0,0,0,128,0,0,0,163,0,0,0,127,0,0,0,163,0,0,0,126,0,0,0,165,0,0,0,124,0,0,0,165,0,0,0,122,0,0,0,159,0,0,0,122,0,0,0,158,0,0,0,121,0,0,0,158,0,0,0,70,0,0,0,127,0,0,0,70,0,0,0,124,0,0,0,67,0,0,0,124,0,0,0,40,0,0,0,125,0,0,0,39,0,0,0,126,0,0,0,39,0,0,0,127,0,0,0,38,0,0,0,127,0,0,0,36,0,0,0,128,0,0,0,35,0,0,0,127,0,0,0,34,0,0,0,127,0,0,0,32,0,0,0,125,0,0,0,30,0,0,0]
,[110,0,0,0,125,0,0,0,110,0,0,0,129,0,0,0,108,0,0,0,131,0,0,0,94,0,0,0,131,0,0,0,93,0,0,0,130,0,0,0,93,0,0,0,134,0,0,0,94,0,0,0,133,0,0,0,109,0,0,0,133,0,0,0,110,0,0,0,134,0,0,0,110,0,0,0,139,0,0,0,112,0,0,0,139,0,0,0,113,0,0,0,138,0,0,0,114,0,0,0,138,0,0,0,115,0,0,0,137,0,0,0,116,0,0,0,137,0,0,0,118,0,0,0,135,0,0,0,119,0,0,0,135,0,0,0,120,0,0,0,134,0,0,0,121,0,0,0,134,0,0,0,122,0,0,0,135,0,0,0,122,0,0,0,162,0,0,0,121,0,0,0,163,0,0,0,93,0,0,0,163,0,0,0,122,0,0,0,163,0,0,0,122,0,0,0,133,0,0,0,121,0,0,0,133,0,0,0,120,0,0,0,134,0,0,0,119,0,0,0,134,0,0,0,118,0,0,0,135,0,0,0,117,0,0,0,135,0,0,0,115,0,0,0,137,0,0,0,114,0,0,0,137,0,0,0,113,0,0,0,138,0,0,0,112,0,0,0,138,0,0,0,111,0,0,0,139,0,0,0,110,0,0,0,138,0,0,0,110,0,0,0,133,0,0,0,94,0,0,0,133,0,0,0,93,0,0,0,132,0,0,0,94,0,0,0,131,0,0,0,109,0,0,0,131,0,0,0,109,0,0,0,130,0,0,0,110,0,0,0,129,0,0,0]
,[81,0,0,0,96,0,0,0,81,0,0,0,164,0,0,0,80,0,0,0,165,0,0,0,61,0,0,0,165,0,0,0,58,0,0,0,162,0,0,0,53,0,0,0,162,0,0,0,51,0,0,0,164,0,0,0,51,0,0,0,169,0,0,0,53,0,0,0,171,0,0,0,58,0,0,0,171,0,0,0,60,0,0,0,169,0,0,0,60,0,0,0,168,0,0,0,61,0,0,0,167,0,0,0,83,0,0,0,167,0,0,0,83,0,0,0,96,0,0,0]
,[91,0,0,0,153,0,0,0,90,0,0,0,154,0,0,0,90,0,0,0,162,0,0,0,91,0,0,0,163,0,0,0,91,0,0,0,166,0,0,0,90,0,0,0,167,0,0,0,90,0,0,0,175,0,0,0,91,0,0,0,176,0,0,0,92,0,0,0,176,0,0,0,91,0,0,0,176,0,0,0,90,0,0,0,175,0,0,0,90,0,0,0,167,0,0,0,91,0,0,0,166,0,0,0,91,0,0,0,163,0,0,0,90,0,0,0,162,0,0,0,90,0,0,0,154,0,0,0,91,0,0,0,153,0,0,0,92,0,0,0,153,0,0,0]
,[90,0,0,0,122,0,0,0,90,0,0,0,129,0,0,0,91,0,0,0,130,0,0,0,91,0,0,0,134,0,0,0,90,0,0,0,135,0,0,0,90,0,0,0,142,0,0,0,92,0,0,0,144,0,0,0,92,0,0,0,143,0,0,0,91,0,0,0,143,0,0,0,90,0,0,0,142,0,0,0,90,0,0,0,135,0,0,0,91,0,0,0,134,0,0,0,91,0,0,0,130,0,0,0,90,0,0,0,129,0,0,0]
,[90,0,0,0,90,0,0,0,90,0,0,0,93,0,0,0,91,0,0,0,94,0,0,0,91,0,0,0,97,0,0,0,90,0,0,0,98,0,0,0,90,0,0,0,110,0,0,0,92,0,0,0,112,0,0,0,92,0,0,0,111,0,0,0,91,0,0,0,111,0,0,0,90,0,0,0,110,0,0,0,90,0,0,0,98,0,0,0,91,0,0,0,97,0,0,0,91,0,0,0,94,0,0,0,90,0,0,0,93,0,0,0]
,[112,0,0,0,125,0,0,0,114,0,0,0,127,0,0,0,115,0,0,0,127,0,0,0,116,0,0,0,128,0,0,0,117,0,0,0,128,0,0,0,118,0,0,0,129,0,0,0,119,0,0,0,129,0,0,0,121,0,0,0,131,0,0,0,123,0,0,0,131,0,0,0,124,0,0,0,132,0,0,0,124,0,0,0,134,0,0,0,124,0,0,0,131,0,0,0,122,0,0,0,131,0,0,0,120,0,0,0,129,0,0,0,119,0,0,0,129,0,0,0,118,0,0,0,128,0,0,0,117,0,0,0,128,0,0,0,116,0,0,0,127,0,0,0,115,0,0,0,127,0,0,0,113,0,0,0,125,0,0,0]
];

var npn_data = [
[150,0,0,0,32,0,0,0,150,0,0,0,72,0,0,0,147,0,0,0,75,0,0,0,146,0,0,0,75,0,0,0,143,0,0,0,78,0,0,0,142,0,0,0,78,0,0,0,140,0,0,0,80,0,0,0,139,0,0,0,80,0,0,0,137,0,0,0,82,0,0,0,136,0,0,0,82,0,0,0,134,0,0,0,84,0,0,0,133,0,0,0,84,0,0,0,130,0,0,0,87,0,0,0,129,0,0,0,87,0,0,0,127,0,0,0,89,0,0,0,126,0,0,0,89,0,0,0,124,0,0,0,91,0,0,0,123,0,0,0,91,0,0,0,121,0,0,0,93,0,0,0,120,0,0,0,93,0,0,0,117,0,0,0,96,0,0,0,116,0,0,0,96,0,0,0,114,0,0,0,98,0,0,0,113,0,0,0,98,0,0,0,112,0,0,0,99,0,0,0,111,0,0,0,98,0,0,0,111,0,0,0,83,0,0,0,108,0,0,0,83,0,0,0,108,0,0,0,113,0,0,0,107,0,0,0,114,0,0,0,51,0,0,0,114,0,0,0,51,0,0,0,116,0,0,0,107,0,0,0,116,0,0,0,108,0,0,0,117,0,0,0,108,0,0,0,145,0,0,0,109,0,0,0,146,0,0,0,111,0,0,0,146,0,0,0,111,0,0,0,131,0,0,0,112,0,0,0,130,0,0,0,113,0,0,0,131,0,0,0,114,0,0,0,131,0,0,0,117,0,0,0,134,0,0,0,118,0,0,0,134,0,0,0,120,0,0,0,136,0,0,0,121,0,0,0,136,0,0,0,124,0,0,0,139,0,0,0,125,0,0,0,139,0,0,0,127,0,0,0,141,0,0,0,127,0,0,0,142,0,0,0,125,0,0,0,144,0,0,0,125,0,0,0,146,0,0,0,131,0,0,0,146,0,0,0,132,0,0,0,147,0,0,0,136,0,0,0,147,0,0,0,138,0,0,0,149,0,0,0,139,0,0,0,149,0,0,0,142,0,0,0,152,0,0,0,143,0,0,0,152,0,0,0,146,0,0,0,155,0,0,0,147,0,0,0,155,0,0,0,150,0,0,0,158,0,0,0,150,0,0,0,196,0,0,0,151,0,0,0,197,0,0,0,152,0,0,0,197,0,0,0,152,0,0,0,156,0,0,0,150,0,0,0,154,0,0,0,149,0,0,0,154,0,0,0,146,0,0,0,151,0,0,0,145,0,0,0,151,0,0,0,143,0,0,0,149,0,0,0,142,0,0,0,149,0,0,0,139,0,0,0,146,0,0,0,138,0,0,0,146,0,0,0,137,0,0,0,145,0,0,0,137,0,0,0,144,0,0,0,136,0,0,0,143,0,0,0,136,0,0,0,141,0,0,0,134,0,0,0,139,0,0,0,134,0,0,0,137,0,0,0,133,0,0,0,136,0,0,0,133,0,0,0,135,0,0,0,132,0,0,0,136,0,0,0,131,0,0,0,136,0,0,0,130,0,0,0,137,0,0,0,130,0,0,0,138,0,0,0,129,0,0,0,139,0,0,0,128,0,0,0,139,0,0,0,125,0,0,0,136,0,0,0,124,0,0,0,136,0,0,0,121,0,0,0,133,0,0,0,120,0,0,0,133,0,0,0,118,0,0,0,131,0,0,0,117,0,0,0,131,0,0,0,114,0,0,0,128,0,0,0,113,0,0,0,128,0,0,0,111,0,0,0,126,0,0,0,111,0,0,0,103,0,0,0,113,0,0,0,101,0,0,0,114,0,0,0,101,0,0,0,116,0,0,0,99,0,0,0,117,0,0,0,99,0,0,0,119,0,0,0,97,0,0,0,120,0,0,0,97,0,0,0,123,0,0,0,94,0,0,0,124,0,0,0,94,0,0,0,126,0,0,0,92,0,0,0,127,0,0,0,92,0,0,0,129,0,0,0,90,0,0,0,130,0,0,0,90,0,0,0,133,0,0,0,87,0,0,0,134,0,0,0,87,0,0,0,136,0,0,0,85,0,0,0,137,0,0,0,85,0,0,0,139,0,0,0,83,0,0,0,140,0,0,0,83,0,0,0,142,0,0,0,81,0,0,0,143,0,0,0,81,0,0,0,146,0,0,0,78,0,0,0,147,0,0,0,78,0,0,0,149,0,0,0,76,0,0,0,150,0,0,0,76,0,0,0,151,0,0,0,75,0,0,0,150,0,0,0,76,0,0,0,149,0,0,0,76,0,0,0,147,0,0,0,78,0,0,0,146,0,0,0,78,0,0,0,144,0,0,0,80,0,0,0,143,0,0,0,80,0,0,0,141,0,0,0,82,0,0,0,140,0,0,0,82,0,0,0,137,0,0,0,85,0,0,0,136,0,0,0,85,0,0,0,134,0,0,0,87,0,0,0,133,0,0,0,87,0,0,0,131,0,0,0,89,0,0,0,130,0,0,0,89,0,0,0,128,0,0,0,91,0,0,0,127,0,0,0,91,0,0,0,124,0,0,0,94,0,0,0,123,0,0,0,94,0,0,0,121,0,0,0,96,0,0,0,120,0,0,0,96,0,0,0,118,0,0,0,98,0,0,0,117,0,0,0,98,0,0,0,114,0,0,0,101,0,0,0,112,0,0,0,101,0,0,0,111,0,0,0,100,0,0,0,112,0,0,0,99,0,0,0,113,0,0,0,99,0,0,0,116,0,0,0,96,0,0,0,117,0,0,0,96,0,0,0,119,0,0,0,94,0,0,0,120,0,0,0,94,0,0,0,122,0,0,0,92,0,0,0,123,0,0,0,92,0,0,0,126,0,0,0,89,0,0,0,127,0,0,0,89,0,0,0,129,0,0,0,87,0,0,0,130,0,0,0,87,0,0,0,132,0,0,0,85,0,0,0,133,0,0,0,85,0,0,0,135,0,0,0,83,0,0,0,136,0,0,0,83,0,0,0,139,0,0,0,80,0,0,0,140,0,0,0,80,0,0,0,142,0,0,0,78,0,0,0,143,0,0,0,78,0,0,0,145,0,0,0,76,0,0,0,146,0,0,0,76,0,0,0,148,0,0,0,74,0,0,0,149,0,0,0,74,0,0,0,150,0,0,0,73,0,0,0,150,0,0,0,33,0,0,0,151,0,0,0,32,0,0,0,152,0,0,0,33,0,0,0,152,0,0,0,73,0,0,0,152,0,0,0,32,0,0,0]
];

var pnp_data = [
[183,0,0,0,42,0,0,0,182,0,0,0,43,0,0,0,182,0,0,0,93,0,0,0,181,0,0,0,94,0,0,0,180,0,0,0,94,0,0,0,178,0,0,0,96,0,0,0,177,0,0,0,96,0,0,0,175,0,0,0,98,0,0,0,174,0,0,0,98,0,0,0,171,0,0,0,101,0,0,0,170,0,0,0,101,0,0,0,168,0,0,0,103,0,0,0,167,0,0,0,103,0,0,0,165,0,0,0,105,0,0,0,164,0,0,0,105,0,0,0,162,0,0,0,107,0,0,0,161,0,0,0,107,0,0,0,158,0,0,0,110,0,0,0,157,0,0,0,110,0,0,0,155,0,0,0,112,0,0,0,154,0,0,0,112,0,0,0,152,0,0,0,114,0,0,0,151,0,0,0,114,0,0,0,148,0,0,0,117,0,0,0,147,0,0,0,117,0,0,0,145,0,0,0,119,0,0,0,144,0,0,0,119,0,0,0,142,0,0,0,121,0,0,0,141,0,0,0,121,0,0,0,139,0,0,0,123,0,0,0,138,0,0,0,123,0,0,0,136,0,0,0,125,0,0,0,137,0,0,0,124,0,0,0,138,0,0,0,124,0,0,0,140,0,0,0,122,0,0,0,141,0,0,0,122,0,0,0,143,0,0,0,120,0,0,0,144,0,0,0,120,0,0,0,147,0,0,0,117,0,0,0,148,0,0,0,117,0,0,0,150,0,0,0,115,0,0,0,151,0,0,0,115,0,0,0,153,0,0,0,113,0,0,0,154,0,0,0,113,0,0,0,156,0,0,0,111,0,0,0,157,0,0,0,111,0,0,0,160,0,0,0,108,0,0,0,161,0,0,0,108,0,0,0,163,0,0,0,106,0,0,0,164,0,0,0,106,0,0,0,166,0,0,0,104,0,0,0,167,0,0,0,104,0,0,0,169,0,0,0,102,0,0,0,170,0,0,0,102,0,0,0,173,0,0,0,99,0,0,0,174,0,0,0,99,0,0,0,176,0,0,0,97,0,0,0,177,0,0,0,97,0,0,0,179,0,0,0,95,0,0,0,180,0,0,0,95,0,0,0,182,0,0,0,93,0,0,0,182,0,0,0,43,0,0,0,183,0,0,0,42,0,0,0,184,0,0,0,43,0,0,0,184,0,0,0,94,0,0,0,181,0,0,0,97,0,0,0,180,0,0,0,97,0,0,0,178,0,0,0,99,0,0,0,177,0,0,0,99,0,0,0,175,0,0,0,101,0,0,0,174,0,0,0,101,0,0,0,171,0,0,0,104,0,0,0,170,0,0,0,104,0,0,0,168,0,0,0,106,0,0,0,167,0,0,0,106,0,0,0,165,0,0,0,108,0,0,0,164,0,0,0,108,0,0,0,162,0,0,0,110,0,0,0,161,0,0,0,110,0,0,0,158,0,0,0,113,0,0,0,157,0,0,0,113,0,0,0,155,0,0,0,115,0,0,0,154,0,0,0,115,0,0,0,152,0,0,0,117,0,0,0,151,0,0,0,117,0,0,0,149,0,0,0,119,0,0,0,148,0,0,0,119,0,0,0,145,0,0,0,122,0,0,0,144,0,0,0,122,0,0,0,142,0,0,0,124,0,0,0,141,0,0,0,124,0,0,0,139,0,0,0,126,0,0,0,138,0,0,0,126,0,0,0,136,0,0,0,128,0,0,0,135,0,0,0,128,0,0,0,134,0,0,0,129,0,0,0,134,0,0,0,161,0,0,0,135,0,0,0,161,0,0,0,136,0,0,0,162,0,0,0,137,0,0,0,162,0,0,0,140,0,0,0,165,0,0,0,141,0,0,0,165,0,0,0,143,0,0,0,167,0,0,0,144,0,0,0,167,0,0,0,147,0,0,0,170,0,0,0,148,0,0,0,170,0,0,0,150,0,0,0,172,0,0,0,151,0,0,0,172,0,0,0,154,0,0,0,175,0,0,0,158,0,0,0,175,0,0,0,159,0,0,0,176,0,0,0,167,0,0,0,176,0,0,0,168,0,0,0,177,0,0,0,168,0,0,0,178,0,0,0,167,0,0,0,179,0,0,0,167,0,0,0,180,0,0,0,166,0,0,0,181,0,0,0,166,0,0,0,183,0,0,0,168,0,0,0,185,0,0,0,169,0,0,0,185,0,0,0,172,0,0,0,188,0,0,0,173,0,0,0,188,0,0,0,175,0,0,0,190,0,0,0,176,0,0,0,190,0,0,0,179,0,0,0,193,0,0,0,180,0,0,0,193,0,0,0,182,0,0,0,195,0,0,0,183,0,0,0,195,0,0,0,185,0,0,0,197,0,0,0,185,0,0,0,248,0,0,0,185,0,0,0,197,0,0,0,182,0,0,0,194,0,0,0,181,0,0,0,194,0,0,0,179,0,0,0,192,0,0,0,178,0,0,0,192,0,0,0,175,0,0,0,189,0,0,0,174,0,0,0,189,0,0,0,172,0,0,0,187,0,0,0,171,0,0,0,187,0,0,0,168,0,0,0,184,0,0,0,167,0,0,0,184,0,0,0,166,0,0,0,183,0,0,0,166,0,0,0,182,0,0,0,167,0,0,0,181,0,0,0,167,0,0,0,180,0,0,0,169,0,0,0,178,0,0,0,168,0,0,0,177,0,0,0,168,0,0,0,176,0,0,0,159,0,0,0,176,0,0,0,158,0,0,0,175,0,0,0,154,0,0,0,175,0,0,0,150,0,0,0,171,0,0,0,149,0,0,0,171,0,0,0,147,0,0,0,169,0,0,0,146,0,0,0,169,0,0,0,143,0,0,0,166,0,0,0,142,0,0,0,166,0,0,0,140,0,0,0,164,0,0,0,139,0,0,0,164,0,0,0,136,0,0,0,161,0,0,0,135,0,0,0,161,0,0,0,134,0,0,0,160,0,0,0,134,0,0,0,130,0,0,0,137,0,0,0,127,0,0,0,138,0,0,0,127,0,0,0,140,0,0,0,125,0,0,0,141,0,0,0,125,0,0,0,143,0,0,0,123,0,0,0,144,0,0,0,123,0,0,0,147,0,0,0,120,0,0,0,148,0,0,0,120,0,0,0,150,0,0,0,118,0,0,0,151,0,0,0,118,0,0,0,153,0,0,0,116,0,0,0,154,0,0,0,116,0,0,0,156,0,0,0,114,0,0,0,157,0,0,0,114,0,0,0,160,0,0,0,111,0,0,0,161,0,0,0,111,0,0,0,163,0,0,0,109,0,0,0,164,0,0,0,109,0,0,0,166,0,0,0,107,0,0,0,167,0,0,0,107,0,0,0,170,0,0,0,104,0,0,0,171,0,0,0,104,0,0,0,173,0,0,0,102,0,0,0,174,0,0,0,102,0,0,0,176,0,0,0,100,0,0,0,177,0,0,0,100,0,0,0,179,0,0,0,98,0,0,0,180,0,0,0,98,0,0,0,183,0,0,0,95,0,0,0,184,0,0,0,95,0,0,0,184,0,0,0,42,0,0,0]
,[130,0,0,0,105,0,0,0,130,0,0,0,143,0,0,0,129,0,0,0,144,0,0,0,60,0,0,0,144,0,0,0,59,0,0,0,145,0,0,0,59,0,0,0,146,0,0,0,129,0,0,0,146,0,0,0,130,0,0,0,147,0,0,0,130,0,0,0,183,0,0,0,131,0,0,0,184,0,0,0,133,0,0,0,184,0,0,0,133,0,0,0,183,0,0,0,134,0,0,0,182,0,0,0,134,0,0,0,163,0,0,0,134,0,0,0,182,0,0,0,132,0,0,0,184,0,0,0,130,0,0,0,182,0,0,0,130,0,0,0,146,0,0,0,60,0,0,0,146,0,0,0,59,0,0,0,145,0,0,0,60,0,0,0,144,0,0,0,130,0,0,0,144,0,0,0,130,0,0,0,106,0,0,0,131,0,0,0,105,0,0,0,132,0,0,0,105,0,0,0,134,0,0,0,107,0,0,0,134,0,0,0,126,0,0,0,134,0,0,0,107,0,0,0,133,0,0,0,106,0,0,0,133,0,0,0,105,0,0,0]
,[136,0,0,0,164,0,0,0,136,0,0,0,165,0,0,0,137,0,0,0,165,0,0,0,139,0,0,0,167,0,0,0,140,0,0,0,167,0,0,0,143,0,0,0,170,0,0,0,144,0,0,0,170,0,0,0,146,0,0,0,172,0,0,0,147,0,0,0,172,0,0,0,150,0,0,0,175,0,0,0,151,0,0,0,175,0,0,0,154,0,0,0,178,0,0,0,154,0,0,0,179,0,0,0,155,0,0,0,180,0,0,0,155,0,0,0,181,0,0,0,156,0,0,0,182,0,0,0,156,0,0,0,183,0,0,0,157,0,0,0,184,0,0,0,157,0,0,0,186,0,0,0,158,0,0,0,187,0,0,0,158,0,0,0,188,0,0,0,159,0,0,0,189,0,0,0,159,0,0,0,190,0,0,0,161,0,0,0,190,0,0,0,161,0,0,0,189,0,0,0,163,0,0,0,187,0,0,0,163,0,0,0,186,0,0,0,164,0,0,0,185,0,0,0,165,0,0,0,185,0,0,0,168,0,0,0,188,0,0,0,169,0,0,0,188,0,0,0,171,0,0,0,190,0,0,0,172,0,0,0,190,0,0,0,175,0,0,0,193,0,0,0,176,0,0,0,193,0,0,0,179,0,0,0,196,0,0,0,180,0,0,0,196,0,0,0,183,0,0,0,199,0,0,0,183,0,0,0,248,0,0,0,183,0,0,0,198,0,0,0,182,0,0,0,197,0,0,0,181,0,0,0,197,0,0,0,179,0,0,0,195,0,0,0,178,0,0,0,195,0,0,0,175,0,0,0,192,0,0,0,174,0,0,0,192,0,0,0,172,0,0,0,190,0,0,0,171,0,0,0,190,0,0,0,168,0,0,0,187,0,0,0,167,0,0,0,187,0,0,0,165,0,0,0,185,0,0,0,163,0,0,0,185,0,0,0,163,0,0,0,186,0,0,0,161,0,0,0,188,0,0,0,161,0,0,0,189,0,0,0,160,0,0,0,190,0,0,0,159,0,0,0,189,0,0,0,159,0,0,0,188,0,0,0,158,0,0,0,187,0,0,0,158,0,0,0,186,0,0,0,157,0,0,0,185,0,0,0,157,0,0,0,183,0,0,0,156,0,0,0,182,0,0,0,156,0,0,0,181,0,0,0,155,0,0,0,180,0,0,0,155,0,0,0,179,0,0,0,154,0,0,0,178,0,0,0,154,0,0,0,177,0,0,0,153,0,0,0,177,0,0,0,150,0,0,0,174,0,0,0,149,0,0,0,174,0,0,0,147,0,0,0,172,0,0,0,146,0,0,0,172,0,0,0,143,0,0,0,169,0,0,0,142,0,0,0,169,0,0,0,140,0,0,0,167,0,0,0,139,0,0,0,167,0,0,0]
];


nmos_data = [
[63,0,0,0,106,0,0,0,63,0,0,0,128,0,0,0,65,0,0,0,126,0,0,0,65,0,0,0,119,0,0,0,66,0,0,0,118,0,0,0,68,0,0,0,120,0,0,0,69,0,0,0,120,0,0,0,70,0,0,0,121,0,0,0,71,0,0,0,121,0,0,0,72,0,0,0,122,0,0,0,73,0,0,0,122,0,0,0,75,0,0,0,124,0,0,0,77,0,0,0,122,0,0,0,77,0,0,0,119,0,0,0,78,0,0,0,118,0,0,0,91,0,0,0,118,0,0,0,92,0,0,0,119,0,0,0,92,0,0,0,143,0,0,0,89,0,0,0,146,0,0,0,88,0,0,0,145,0,0,0,66,0,0,0,145,0,0,0,65,0,0,0,144,0,0,0,65,0,0,0,137,0,0,0,64,0,0,0,136,0,0,0,63,0,0,0,136,0,0,0,63,0,0,0,157,0,0,0,64,0,0,0,157,0,0,0,65,0,0,0,156,0,0,0,65,0,0,0,146,0,0,0,66,0,0,0,145,0,0,0,88,0,0,0,145,0,0,0,90,0,0,0,147,0,0,0,90,0,0,0,148,0,0,0,92,0,0,0,150,0,0,0,92,0,0,0,172,0,0,0,90,0,0,0,174,0,0,0,90,0,0,0,176,0,0,0,91,0,0,0,177,0,0,0,91,0,0,0,178,0,0,0,92,0,0,0,179,0,0,0,92,0,0,0,199,0,0,0,90,0,0,0,201,0,0,0,89,0,0,0,201,0,0,0,89,0,0,0,203,0,0,0,88,0,0,0,204,0,0,0,88,0,0,0,205,0,0,0,89,0,0,0,206,0,0,0,89,0,0,0,207,0,0,0,90,0,0,0,208,0,0,0,91,0,0,0,208,0,0,0,92,0,0,0,209,0,0,0,93,0,0,0,209,0,0,0,94,0,0,0,208,0,0,0,96,0,0,0,208,0,0,0,96,0,0,0,207,0,0,0,97,0,0,0,206,0,0,0,97,0,0,0,202,0,0,0,94,0,0,0,199,0,0,0,94,0,0,0,178,0,0,0,96,0,0,0,176,0,0,0,124,0,0,0,176,0,0,0,124,0,0,0,125,0,0,0,125,0,0,0,124,0,0,0,130,0,0,0,124,0,0,0,130,0,0,0,122,0,0,0,129,0,0,0,121,0,0,0,129,0,0,0,120,0,0,0,128,0,0,0,119,0,0,0,128,0,0,0,118,0,0,0,126,0,0,0,116,0,0,0,126,0,0,0,115,0,0,0,125,0,0,0,114,0,0,0,126,0,0,0,113,0,0,0,130,0,0,0,113,0,0,0,125,0,0,0,113,0,0,0,125,0,0,0,115,0,0,0,126,0,0,0,116,0,0,0,126,0,0,0,117,0,0,0,128,0,0,0,119,0,0,0,128,0,0,0,120,0,0,0,129,0,0,0,121,0,0,0,129,0,0,0,122,0,0,0,130,0,0,0,123,0,0,0,129,0,0,0,124,0,0,0,124,0,0,0,124,0,0,0,124,0,0,0,175,0,0,0,123,0,0,0,176,0,0,0,95,0,0,0,176,0,0,0,94,0,0,0,177,0,0,0,94,0,0,0,199,0,0,0,93,0,0,0,200,0,0,0,92,0,0,0,199,0,0,0,92,0,0,0,178,0,0,0,90,0,0,0,176,0,0,0,90,0,0,0,175,0,0,0,92,0,0,0,173,0,0,0,92,0,0,0,149,0,0,0,90,0,0,0,147,0,0,0,90,0,0,0,146,0,0,0,92,0,0,0,144,0,0,0,92,0,0,0,118,0,0,0,78,0,0,0,118,0,0,0,77,0,0,0,117,0,0,0,78,0,0,0,116,0,0,0,93,0,0,0,116,0,0,0,78,0,0,0,116,0,0,0,77,0,0,0,115,0,0,0,77,0,0,0,112,0,0,0,75,0,0,0,110,0,0,0,73,0,0,0,112,0,0,0,72,0,0,0,112,0,0,0,71,0,0,0,113,0,0,0,70,0,0,0,113,0,0,0,69,0,0,0,114,0,0,0,68,0,0,0,114,0,0,0,66,0,0,0,116,0,0,0,65,0,0,0,115,0,0,0,65,0,0,0,107,0,0,0,65,0,0,0,116,0,0,0,66,0,0,0,117,0,0,0,65,0,0,0,118,0,0,0,65,0,0,0,126,0,0,0,64,0,0,0,127,0,0,0,63,0,0,0,126,0,0,0]
,[91,0,0,0,24,0,0,0,90,0,0,0,25,0,0,0,89,0,0,0,25,0,0,0,88,0,0,0,26,0,0,0,88,0,0,0,31,0,0,0,91,0,0,0,34,0,0,0,91,0,0,0,58,0,0,0,90,0,0,0,59,0,0,0,90,0,0,0,60,0,0,0,89,0,0,0,61,0,0,0,89,0,0,0,63,0,0,0,91,0,0,0,65,0,0,0,91,0,0,0,82,0,0,0,90,0,0,0,83,0,0,0,66,0,0,0,83,0,0,0,65,0,0,0,82,0,0,0,65,0,0,0,78,0,0,0,64,0,0,0,77,0,0,0,63,0,0,0,77,0,0,0,63,0,0,0,98,0,0,0,64,0,0,0,98,0,0,0,65,0,0,0,97,0,0,0,65,0,0,0,86,0,0,0,66,0,0,0,85,0,0,0,93,0,0,0,85,0,0,0,93,0,0,0,66,0,0,0,96,0,0,0,63,0,0,0,95,0,0,0,63,0,0,0,93,0,0,0,65,0,0,0,93,0,0,0,84,0,0,0,92,0,0,0,85,0,0,0,66,0,0,0,85,0,0,0,65,0,0,0,84,0,0,0,66,0,0,0,83,0,0,0,91,0,0,0,83,0,0,0,91,0,0,0,64,0,0,0,89,0,0,0,62,0,0,0,89,0,0,0,61,0,0,0,91,0,0,0,59,0,0,0,91,0,0,0,34,0,0,0,92,0,0,0,33,0,0,0,93,0,0,0,34,0,0,0,93,0,0,0,59,0,0,0,94,0,0,0,60,0,0,0,121,0,0,0,60,0,0,0,122,0,0,0,61,0,0,0,122,0,0,0,110,0,0,0,121,0,0,0,111,0,0,0,117,0,0,0,111,0,0,0,122,0,0,0,111,0,0,0,122,0,0,0,62,0,0,0,123,0,0,0,61,0,0,0,124,0,0,0,62,0,0,0,124,0,0,0,111,0,0,0,130,0,0,0,111,0,0,0,125,0,0,0,111,0,0,0,124,0,0,0,110,0,0,0,124,0,0,0,61,0,0,0,122,0,0,0,61,0,0,0,121,0,0,0,60,0,0,0,95,0,0,0,60,0,0,0,93,0,0,0,58,0,0,0,93,0,0,0,34,0,0,0,96,0,0,0,31,0,0,0,96,0,0,0,26,0,0,0,95,0,0,0,25,0,0,0,94,0,0,0,25,0,0,0,93,0,0,0,24,0,0,0]
,[54,0,0,0,84,0,0,0,54,0,0,0,146,0,0,0,53,0,0,0,147,0,0,0,36,0,0,0,147,0,0,0,33,0,0,0,144,0,0,0,29,0,0,0,144,0,0,0,27,0,0,0,146,0,0,0,27,0,0,0,147,0,0,0,26,0,0,0,148,0,0,0,26,0,0,0,149,0,0,0,27,0,0,0,150,0,0,0,27,0,0,0,151,0,0,0,28,0,0,0,152,0,0,0,29,0,0,0,152,0,0,0,30,0,0,0,153,0,0,0,32,0,0,0,153,0,0,0,33,0,0,0,152,0,0,0,34,0,0,0,152,0,0,0,35,0,0,0,151,0,0,0,35,0,0,0,150,0,0,0,36,0,0,0,149,0,0,0,55,0,0,0,149,0,0,0,56,0,0,0,148,0,0,0,56,0,0,0,85,0,0,0,56,0,0,0,148,0,0,0,55,0,0,0,149,0,0,0,36,0,0,0,149,0,0,0,35,0,0,0,148,0,0,0,36,0,0,0,147,0,0,0,54,0,0,0,147,0,0,0]
,[122,0,0,0,113,0,0,0,122,0,0,0,114,0,0,0,120,0,0,0,116,0,0,0,120,0,0,0,117,0,0,0,119,0,0,0,118,0,0,0,119,0,0,0,119,0,0,0,117,0,0,0,121,0,0,0,117,0,0,0,124,0,0,0,121,0,0,0,124,0,0,0,122,0,0,0,125,0,0,0,122,0,0,0,173,0,0,0,121,0,0,0,174,0,0,0,96,0,0,0,174,0,0,0,94,0,0,0,172,0,0,0,94,0,0,0,149,0,0,0,95,0,0,0,148,0,0,0,95,0,0,0,145,0,0,0,94,0,0,0,144,0,0,0,94,0,0,0,118,0,0,0,94,0,0,0,145,0,0,0,95,0,0,0,146,0,0,0,95,0,0,0,147,0,0,0,94,0,0,0,148,0,0,0,94,0,0,0,173,0,0,0,95,0,0,0,174,0,0,0,122,0,0,0,174,0,0,0,122,0,0,0,124,0,0,0,118,0,0,0,124,0,0,0,117,0,0,0,123,0,0,0,117,0,0,0,122,0,0,0,119,0,0,0,120,0,0,0,119,0,0,0,119,0,0,0,120,0,0,0,118,0,0,0,120,0,0,0,117,0,0,0,122,0,0,0,115,0,0,0]
];

pmos_data = [
    [92,0,0,0,27,0,0,0,91,0,0,0,28,0,0,0,90,0,0,0,28,0,0,0,89,0,0,0,29,0,0,0,89,0,0,0,34,0,0,0,92,0,0,0,37,0,0,0,92,0,0,0,61,0,0,0,91,0,0,0,62,0,0,0,91,0,0,0,63,0,0,0,90,0,0,0,64,0,0,0,90,0,0,0,66,0,0,0,92,0,0,0,68,0,0,0,92,0,0,0,85,0,0,0,91,0,0,0,86,0,0,0,67,0,0,0,86,0,0,0,66,0,0,0,85,0,0,0,66,0,0,0,81,0,0,0,65,0,0,0,80,0,0,0,64,0,0,0,80,0,0,0,64,0,0,0,101,0,0,0,65,0,0,0,101,0,0,0,66,0,0,0,100,0,0,0,66,0,0,0,89,0,0,0,67,0,0,0,88,0,0,0,94,0,0,0,88,0,0,0,94,0,0,0,69,0,0,0,97,0,0,0,66,0,0,0,96,0,0,0,66,0,0,0,94,0,0,0,68,0,0,0,94,0,0,0,87,0,0,0,93,0,0,0,88,0,0,0,67,0,0,0,88,0,0,0,66,0,0,0,87,0,0,0,67,0,0,0,86,0,0,0,92,0,0,0,86,0,0,0,92,0,0,0,67,0,0,0,90,0,0,0,65,0,0,0,90,0,0,0,64,0,0,0,92,0,0,0,62,0,0,0,92,0,0,0,37,0,0,0,93,0,0,0,36,0,0,0,94,0,0,0,37,0,0,0,94,0,0,0,62,0,0,0,96,0,0,0,64,0,0,0,97,0,0,0,63,0,0,0,122,0,0,0,63,0,0,0,123,0,0,0,64,0,0,0,123,0,0,0,110,0,0,0,122,0,0,0,111,0,0,0,118,0,0,0,111,0,0,0,118,0,0,0,113,0,0,0,119,0,0,0,114,0,0,0,119,0,0,0,115,0,0,0,120,0,0,0,116,0,0,0,120,0,0,0,117,0,0,0,121,0,0,0,118,0,0,0,121,0,0,0,119,0,0,0,123,0,0,0,121,0,0,0,123,0,0,0,122,0,0,0,123,0,0,0,120,0,0,0,121,0,0,0,118,0,0,0,121,0,0,0,117,0,0,0,120,0,0,0,116,0,0,0,120,0,0,0,115,0,0,0,119,0,0,0,114,0,0,0,119,0,0,0,113,0,0,0,118,0,0,0,112,0,0,0,119,0,0,0,111,0,0,0,122,0,0,0,111,0,0,0,123,0,0,0,110,0,0,0,123,0,0,0,65,0,0,0,124,0,0,0,64,0,0,0,125,0,0,0,65,0,0,0,125,0,0,0,110,0,0,0,126,0,0,0,111,0,0,0,130,0,0,0,111,0,0,0,131,0,0,0,112,0,0,0,130,0,0,0,113,0,0,0,130,0,0,0,114,0,0,0,128,0,0,0,116,0,0,0,128,0,0,0,117,0,0,0,127,0,0,0,118,0,0,0,127,0,0,0,119,0,0,0,126,0,0,0,120,0,0,0,126,0,0,0,122,0,0,0,130,0,0,0,122,0,0,0,131,0,0,0,123,0,0,0,130,0,0,0,124,0,0,0,126,0,0,0,124,0,0,0,125,0,0,0,125,0,0,0,125,0,0,0,178,0,0,0,124,0,0,0,179,0,0,0,96,0,0,0,179,0,0,0,95,0,0,0,180,0,0,0,95,0,0,0,202,0,0,0,94,0,0,0,203,0,0,0,93,0,0,0,202,0,0,0,93,0,0,0,181,0,0,0,91,0,0,0,179,0,0,0,91,0,0,0,178,0,0,0,93,0,0,0,176,0,0,0,93,0,0,0,152,0,0,0,91,0,0,0,150,0,0,0,91,0,0,0,149,0,0,0,93,0,0,0,147,0,0,0,93,0,0,0,122,0,0,0,92,0,0,0,121,0,0,0,91,0,0,0,121,0,0,0,90,0,0,0,122,0,0,0,89,0,0,0,122,0,0,0,87,0,0,0,124,0,0,0,86,0,0,0,124,0,0,0,85,0,0,0,125,0,0,0,84,0,0,0,125,0,0,0,83,0,0,0,126,0,0,0,82,0,0,0,126,0,0,0,81,0,0,0,125,0,0,0,81,0,0,0,113,0,0,0,81,0,0,0,118,0,0,0,80,0,0,0,119,0,0,0,67,0,0,0,119,0,0,0,66,0,0,0,118,0,0,0,66,0,0,0,110,0,0,0,66,0,0,0,129,0,0,0,65,0,0,0,130,0,0,0,64,0,0,0,129,0,0,0,64,0,0,0,109,0,0,0,64,0,0,0,131,0,0,0,66,0,0,0,129,0,0,0,66,0,0,0,122,0,0,0,67,0,0,0,121,0,0,0,80,0,0,0,121,0,0,0,81,0,0,0,122,0,0,0,81,0,0,0,126,0,0,0,84,0,0,0,126,0,0,0,85,0,0,0,125,0,0,0,86,0,0,0,125,0,0,0,87,0,0,0,124,0,0,0,88,0,0,0,124,0,0,0,90,0,0,0,122,0,0,0,91,0,0,0,122,0,0,0,92,0,0,0,121,0,0,0,93,0,0,0,122,0,0,0,93,0,0,0,146,0,0,0,90,0,0,0,149,0,0,0,89,0,0,0,148,0,0,0,67,0,0,0,148,0,0,0,66,0,0,0,147,0,0,0,66,0,0,0,140,0,0,0,65,0,0,0,139,0,0,0,64,0,0,0,139,0,0,0,64,0,0,0,160,0,0,0,65,0,0,0,160,0,0,0,66,0,0,0,159,0,0,0,66,0,0,0,149,0,0,0,67,0,0,0,148,0,0,0,89,0,0,0,148,0,0,0,91,0,0,0,150,0,0,0,91,0,0,0,151,0,0,0,93,0,0,0,153,0,0,0,93,0,0,0,175,0,0,0,91,0,0,0,177,0,0,0,91,0,0,0,179,0,0,0,92,0,0,0,180,0,0,0,92,0,0,0,181,0,0,0,93,0,0,0,182,0,0,0,93,0,0,0,202,0,0,0,91,0,0,0,204,0,0,0,90,0,0,0,204,0,0,0,90,0,0,0,206,0,0,0,89,0,0,0,207,0,0,0,89,0,0,0,208,0,0,0,90,0,0,0,209,0,0,0,90,0,0,0,210,0,0,0,91,0,0,0,211,0,0,0,92,0,0,0,211,0,0,0,93,0,0,0,212,0,0,0,94,0,0,0,212,0,0,0,95,0,0,0,211,0,0,0,97,0,0,0,211,0,0,0,97,0,0,0,210,0,0,0,98,0,0,0,209,0,0,0,98,0,0,0,205,0,0,0,95,0,0,0,202,0,0,0,95,0,0,0,181,0,0,0,97,0,0,0,179,0,0,0,125,0,0,0,179,0,0,0,125,0,0,0,126,0,0,0,127,0,0,0,124,0,0,0,131,0,0,0,124,0,0,0,131,0,0,0,123,0,0,0,130,0,0,0,122,0,0,0,127,0,0,0,122,0,0,0,126,0,0,0,121,0,0,0,127,0,0,0,120,0,0,0,127,0,0,0,119,0,0,0,128,0,0,0,118,0,0,0,128,0,0,0,117,0,0,0,130,0,0,0,115,0,0,0,130,0,0,0,114,0,0,0,131,0,0,0,113,0,0,0,131,0,0,0,111,0,0,0,127,0,0,0,111,0,0,0,125,0,0,0,109,0,0,0,125,0,0,0,64,0,0,0,123,0,0,0,64,0,0,0,122,0,0,0,63,0,0,0,96,0,0,0,63,0,0,0,94,0,0,0,61,0,0,0,94,0,0,0,37,0,0,0,97,0,0,0,34,0,0,0,97,0,0,0,29,0,0,0,96,0,0,0,28,0,0,0,95,0,0,0,28,0,0,0,94,0,0,0,27,0,0,0]
    ,[55,0,0,0,87,0,0,0,55,0,0,0,149,0,0,0,54,0,0,0,150,0,0,0,37,0,0,0,150,0,0,0,34,0,0,0,147,0,0,0,30,0,0,0,147,0,0,0,28,0,0,0,149,0,0,0,28,0,0,0,150,0,0,0,27,0,0,0,151,0,0,0,27,0,0,0,152,0,0,0,28,0,0,0,153,0,0,0,28,0,0,0,154,0,0,0,29,0,0,0,155,0,0,0,30,0,0,0,155,0,0,0,31,0,0,0,156,0,0,0,33,0,0,0,156,0,0,0,34,0,0,0,155,0,0,0,35,0,0,0,155,0,0,0,36,0,0,0,154,0,0,0,36,0,0,0,153,0,0,0,37,0,0,0,152,0,0,0,56,0,0,0,152,0,0,0,57,0,0,0,151,0,0,0,57,0,0,0,88,0,0,0,57,0,0,0,151,0,0,0,56,0,0,0,152,0,0,0,37,0,0,0,152,0,0,0,36,0,0,0,151,0,0,0,37,0,0,0,150,0,0,0,55,0,0,0,150,0,0,0]
    ,[83,0,0,0,113,0,0,0,83,0,0,0,114,0,0,0,84,0,0,0,115,0,0,0,85,0,0,0,115,0,0,0,86,0,0,0,116,0,0,0,87,0,0,0,116,0,0,0,88,0,0,0,117,0,0,0,89,0,0,0,117,0,0,0,91,0,0,0,119,0,0,0,93,0,0,0,119,0,0,0,95,0,0,0,121,0,0,0,95,0,0,0,148,0,0,0,96,0,0,0,149,0,0,0,96,0,0,0,150,0,0,0,95,0,0,0,151,0,0,0,95,0,0,0,176,0,0,0,96,0,0,0,177,0,0,0,123,0,0,0,177,0,0,0,123,0,0,0,124,0,0,0,119,0,0,0,124,0,0,0,118,0,0,0,123,0,0,0,119,0,0,0,122,0,0,0,121,0,0,0,122,0,0,0,119,0,0,0,122,0,0,0,118,0,0,0,123,0,0,0,118,0,0,0,124,0,0,0,122,0,0,0,124,0,0,0,123,0,0,0,125,0,0,0,123,0,0,0,176,0,0,0,122,0,0,0,177,0,0,0,97,0,0,0,177,0,0,0,95,0,0,0,175,0,0,0,95,0,0,0,152,0,0,0,96,0,0,0,151,0,0,0,96,0,0,0,148,0,0,0,95,0,0,0,147,0,0,0,95,0,0,0,121,0,0,0,94,0,0,0,120,0,0,0,94,0,0,0,119,0,0,0,92,0,0,0,119,0,0,0,90,0,0,0,117,0,0,0,89,0,0,0,117,0,0,0,88,0,0,0,116,0,0,0,87,0,0,0,116,0,0,0,86,0,0,0,115,0,0,0,85,0,0,0,115,0,0,0]
    ];

pnp_data = [
[150,0,0,0,32,0,0,0,150,0,0,0,72,0,0,0,147,0,0,0,75,0,0,0,146,0,0,0,75,0,0,0,143,0,0,0,78,0,0,0,142,0,0,0,78,0,0,0,140,0,0,0,80,0,0,0,139,0,0,0,80,0,0,0,137,0,0,0,82,0,0,0,136,0,0,0,82,0,0,0,134,0,0,0,84,0,0,0,133,0,0,0,84,0,0,0,130,0,0,0,87,0,0,0,129,0,0,0,87,0,0,0,127,0,0,0,89,0,0,0,126,0,0,0,89,0,0,0,124,0,0,0,91,0,0,0,123,0,0,0,91,0,0,0,121,0,0,0,93,0,0,0,120,0,0,0,93,0,0,0,117,0,0,0,96,0,0,0,116,0,0,0,96,0,0,0,114,0,0,0,98,0,0,0,113,0,0,0,98,0,0,0,112,0,0,0,99,0,0,0,111,0,0,0,98,0,0,0,111,0,0,0,83,0,0,0,108,0,0,0,83,0,0,0,108,0,0,0,113,0,0,0,107,0,0,0,114,0,0,0,51,0,0,0,114,0,0,0,51,0,0,0,116,0,0,0,107,0,0,0,116,0,0,0,108,0,0,0,117,0,0,0,108,0,0,0,145,0,0,0,109,0,0,0,146,0,0,0,111,0,0,0,146,0,0,0,111,0,0,0,131,0,0,0,112,0,0,0,130,0,0,0,113,0,0,0,131,0,0,0,114,0,0,0,131,0,0,0,117,0,0,0,134,0,0,0,118,0,0,0,134,0,0,0,120,0,0,0,136,0,0,0,121,0,0,0,136,0,0,0,124,0,0,0,139,0,0,0,125,0,0,0,139,0,0,0,127,0,0,0,141,0,0,0,127,0,0,0,142,0,0,0,125,0,0,0,144,0,0,0,125,0,0,0,146,0,0,0,131,0,0,0,146,0,0,0,132,0,0,0,147,0,0,0,136,0,0,0,147,0,0,0,138,0,0,0,149,0,0,0,139,0,0,0,149,0,0,0,142,0,0,0,152,0,0,0,143,0,0,0,152,0,0,0,146,0,0,0,155,0,0,0,147,0,0,0,155,0,0,0,150,0,0,0,158,0,0,0,150,0,0,0,195,0,0,0,151,0,0,0,196,0,0,0,152,0,0,0,196,0,0,0,152,0,0,0,156,0,0,0,150,0,0,0,154,0,0,0,149,0,0,0,154,0,0,0,146,0,0,0,151,0,0,0,145,0,0,0,151,0,0,0,143,0,0,0,149,0,0,0,142,0,0,0,149,0,0,0,139,0,0,0,146,0,0,0,138,0,0,0,146,0,0,0,137,0,0,0,145,0,0,0,137,0,0,0,144,0,0,0,136,0,0,0,143,0,0,0,136,0,0,0,141,0,0,0,134,0,0,0,139,0,0,0,134,0,0,0,137,0,0,0,133,0,0,0,136,0,0,0,133,0,0,0,135,0,0,0,132,0,0,0,136,0,0,0,131,0,0,0,136,0,0,0,130,0,0,0,137,0,0,0,130,0,0,0,138,0,0,0,129,0,0,0,139,0,0,0,128,0,0,0,139,0,0,0,125,0,0,0,136,0,0,0,124,0,0,0,136,0,0,0,121,0,0,0,133,0,0,0,120,0,0,0,133,0,0,0,118,0,0,0,131,0,0,0,117,0,0,0,131,0,0,0,114,0,0,0,128,0,0,0,113,0,0,0,128,0,0,0,111,0,0,0,126,0,0,0,111,0,0,0,103,0,0,0,113,0,0,0,101,0,0,0,114,0,0,0,101,0,0,0,116,0,0,0,99,0,0,0,117,0,0,0,99,0,0,0,119,0,0,0,97,0,0,0,120,0,0,0,97,0,0,0,123,0,0,0,94,0,0,0,124,0,0,0,94,0,0,0,126,0,0,0,92,0,0,0,127,0,0,0,92,0,0,0,129,0,0,0,90,0,0,0,130,0,0,0,90,0,0,0,133,0,0,0,87,0,0,0,134,0,0,0,87,0,0,0,136,0,0,0,85,0,0,0,137,0,0,0,85,0,0,0,139,0,0,0,83,0,0,0,140,0,0,0,83,0,0,0,142,0,0,0,81,0,0,0,143,0,0,0,81,0,0,0,146,0,0,0,78,0,0,0,147,0,0,0,78,0,0,0,149,0,0,0,76,0,0,0,150,0,0,0,76,0,0,0,151,0,0,0,75,0,0,0,150,0,0,0,76,0,0,0,149,0,0,0,76,0,0,0,147,0,0,0,78,0,0,0,146,0,0,0,78,0,0,0,144,0,0,0,80,0,0,0,143,0,0,0,80,0,0,0,141,0,0,0,82,0,0,0,140,0,0,0,82,0,0,0,137,0,0,0,85,0,0,0,136,0,0,0,85,0,0,0,134,0,0,0,87,0,0,0,133,0,0,0,87,0,0,0,131,0,0,0,89,0,0,0,130,0,0,0,89,0,0,0,128,0,0,0,91,0,0,0,127,0,0,0,91,0,0,0,124,0,0,0,94,0,0,0,123,0,0,0,94,0,0,0,121,0,0,0,96,0,0,0,120,0,0,0,96,0,0,0,118,0,0,0,98,0,0,0,117,0,0,0,98,0,0,0,114,0,0,0,101,0,0,0,112,0,0,0,101,0,0,0,111,0,0,0,100,0,0,0,112,0,0,0,99,0,0,0,113,0,0,0,99,0,0,0,116,0,0,0,96,0,0,0,117,0,0,0,96,0,0,0,119,0,0,0,94,0,0,0,120,0,0,0,94,0,0,0,122,0,0,0,92,0,0,0,123,0,0,0,92,0,0,0,126,0,0,0,89,0,0,0,127,0,0,0,89,0,0,0,129,0,0,0,87,0,0,0,130,0,0,0,87,0,0,0,132,0,0,0,85,0,0,0,133,0,0,0,85,0,0,0,135,0,0,0,83,0,0,0,136,0,0,0,83,0,0,0,139,0,0,0,80,0,0,0,140,0,0,0,80,0,0,0,142,0,0,0,78,0,0,0,143,0,0,0,78,0,0,0,145,0,0,0,76,0,0,0,146,0,0,0,76,0,0,0,148,0,0,0,74,0,0,0,149,0,0,0,74,0,0,0,150,0,0,0,73,0,0,0,150,0,0,0,33,0,0,0,151,0,0,0,32,0,0,0,152,0,0,0,33,0,0,0,152,0,0,0,73,0,0,0,152,0,0,0,32,0,0,0]
];

pnp_data = [
[137,0,0,0,36,0,0,0,137,0,0,0,76,0,0,0,134,0,0,0,79,0,0,0,133,0,0,0,79,0,0,0,131,0,0,0,81,0,0,0,130,0,0,0,81,0,0,0,127,0,0,0,84,0,0,0,126,0,0,0,84,0,0,0,124,0,0,0,86,0,0,0,123,0,0,0,86,0,0,0,121,0,0,0,88,0,0,0,120,0,0,0,88,0,0,0,117,0,0,0,91,0,0,0,116,0,0,0,91,0,0,0,114,0,0,0,93,0,0,0,113,0,0,0,93,0,0,0,111,0,0,0,95,0,0,0,110,0,0,0,95,0,0,0,108,0,0,0,97,0,0,0,107,0,0,0,97,0,0,0,104,0,0,0,100,0,0,0,103,0,0,0,100,0,0,0,101,0,0,0,102,0,0,0,100,0,0,0,102,0,0,0,99,0,0,0,103,0,0,0,98,0,0,0,102,0,0,0,98,0,0,0,87,0,0,0,95,0,0,0,87,0,0,0,95,0,0,0,117,0,0,0,94,0,0,0,118,0,0,0,38,0,0,0,118,0,0,0,38,0,0,0,120,0,0,0,94,0,0,0,120,0,0,0,95,0,0,0,121,0,0,0,95,0,0,0,149,0,0,0,96,0,0,0,150,0,0,0,98,0,0,0,150,0,0,0,98,0,0,0,135,0,0,0,99,0,0,0,134,0,0,0,100,0,0,0,135,0,0,0,101,0,0,0,135,0,0,0,104,0,0,0,138,0,0,0,105,0,0,0,138,0,0,0,107,0,0,0,140,0,0,0,108,0,0,0,140,0,0,0,111,0,0,0,143,0,0,0,112,0,0,0,143,0,0,0,114,0,0,0,145,0,0,0,114,0,0,0,146,0,0,0,115,0,0,0,147,0,0,0,115,0,0,0,148,0,0,0,116,0,0,0,149,0,0,0,116,0,0,0,150,0,0,0,117,0,0,0,151,0,0,0,117,0,0,0,152,0,0,0,118,0,0,0,153,0,0,0,118,0,0,0,154,0,0,0,120,0,0,0,154,0,0,0,123,0,0,0,151,0,0,0,125,0,0,0,153,0,0,0,126,0,0,0,153,0,0,0,129,0,0,0,156,0,0,0,130,0,0,0,156,0,0,0,132,0,0,0,158,0,0,0,133,0,0,0,158,0,0,0,137,0,0,0,162,0,0,0,137,0,0,0,200,0,0,0,138,0,0,0,201,0,0,0,139,0,0,0,201,0,0,0,139,0,0,0,160,0,0,0,137,0,0,0,158,0,0,0,136,0,0,0,158,0,0,0,133,0,0,0,155,0,0,0,132,0,0,0,155,0,0,0,130,0,0,0,153,0,0,0,129,0,0,0,153,0,0,0,126,0,0,0,150,0,0,0,125,0,0,0,150,0,0,0,124,0,0,0,149,0,0,0,124,0,0,0,148,0,0,0,126,0,0,0,146,0,0,0,126,0,0,0,144,0,0,0,124,0,0,0,144,0,0,0,123,0,0,0,143,0,0,0,115,0,0,0,143,0,0,0,112,0,0,0,140,0,0,0,111,0,0,0,140,0,0,0,108,0,0,0,137,0,0,0,107,0,0,0,137,0,0,0,105,0,0,0,135,0,0,0,104,0,0,0,135,0,0,0,101,0,0,0,132,0,0,0,100,0,0,0,132,0,0,0,98,0,0,0,130,0,0,0,98,0,0,0,107,0,0,0,100,0,0,0,105,0,0,0,101,0,0,0,105,0,0,0,103,0,0,0,103,0,0,0,104,0,0,0,103,0,0,0,107,0,0,0,100,0,0,0,108,0,0,0,100,0,0,0,110,0,0,0,98,0,0,0,111,0,0,0,98,0,0,0,113,0,0,0,96,0,0,0,114,0,0,0,96,0,0,0,116,0,0,0,94,0,0,0,117,0,0,0,94,0,0,0,120,0,0,0,91,0,0,0,121,0,0,0,91,0,0,0,123,0,0,0,89,0,0,0,124,0,0,0,89,0,0,0,126,0,0,0,87,0,0,0,127,0,0,0,87,0,0,0,130,0,0,0,84,0,0,0,131,0,0,0,84,0,0,0,133,0,0,0,82,0,0,0,134,0,0,0,82,0,0,0,136,0,0,0,80,0,0,0,137,0,0,0,80,0,0,0,139,0,0,0,78,0,0,0,139,0,0,0,36,0,0,0]
];

class model {
    name:string;
    subckt:string;
    def:string[];
    str:string;
    isbase:boolean;
    draw_x:number;
    draw_y:number;
    pin:number;
    vflip:boolean;
    hflip:boolean;
    rotate:number;      //0,0.5,1.0,1.5

    constructor() {
        this.isbase = true;
        this.draw_x = base_draw_x;
        this.draw_y = base_draw_y;
        this.vflip = false;
        this.hflip = false;
        this.rotate = 0.0;
        next_draw_col();            //下一列
    }

    set_subckt(name:string){
        this.name = 'PIN';
        this.subckt = name;
    }
    alias():string{
        return this.def[0];
    }
    scale():number{
        if(
            this.name=='_PNP_'
            ||this.name=='_NPN_'
            ||this.name=='_NMOS_'
            ||this.name=='_PMOS_'
        ){
            return 0.5;
        }
        return 1.0;
    }
    get_port(idx:number):string{
        if(this.def[0]==".SUBCKT"){
            return this.def[idx+2];
        }
        return this.def[idx+1];
    }
}

function get_draw_pos(array,index){
    var x = array[index*8+0];
    var y = array[index*8+4];
    var z = array[index*8+5];
    if(x!==undefined){
        return [x,y,z];
    }
    return null;
}

function draw_array(ctx:CanvasRenderingContext2D,draw_data){
    let minx = 1000;
    let miny = 1000;
    let maxx = -1;
    let maxy = -1;
    let midx = draw_data.midx || 0;
    let midy = draw_data.midy || 0;
    let first = true;
    for (let i = 0; i < draw_data.length; i++) {
        const element = draw_data[i];
        for (let dpos = 0; dpos < (element.length / 8); dpos++) {
            const d = get_draw_pos(element,dpos);
            if(d[2]<=0){
                if(first) ctx.moveTo(d[0]-midx,d[1]-midy);
                else ctx.lineTo(d[0]-midx,d[1]-midy);
                if(d[0]<minx) minx = d[0];
                if(d[1]<miny) miny = d[1];
                if(d[0]>maxx) maxx = d[0];
                if(d[1]>maxy) maxy = d[1];
            }
            first = false;
        }
        first = true;
    }

    // ctx.rect(minx-draw_data.midx,miny-draw_data.midy,maxx-minx,maxy-miny);
    // ctx.moveTo(1000,0);
    // ctx.lineTo(0,0);
    // ctx.lineTo(0,1000);

    draw_data.midx = (maxx+minx) / 2;
    draw_data.midy = (maxy+miny) / 2;

    return [minx,miny,maxx,maxy];
}

function draw_array_coord(ctx:CanvasRenderingContext2D,draw_data){
    let first = true;
    let minx = 1000;
    let miny = 1000;
    let maxx = -50;
    let maxy = -50;
    let midx = draw_data.midx || 0;
    let midy = draw_data.midy || 0;

    for (let i = 0; i < draw_data.length; i++) {
        const element = draw_data[i];
        for (let dpos = 0; dpos < (element.length / 2); dpos++) {
            const d = [element[dpos*2+0],element[dpos*2+1]];

            if(first) ctx.moveTo(d[0]-midx,d[1]-midy);
            else ctx.lineTo(d[0]-midx,d[1]-midy);

            if(d[0]<minx) minx = d[0];
            if(d[1]<miny) miny = d[1];
            if(d[0]>maxx) maxx = d[0];
            if(d[1]>maxy) maxy = d[1];
            first = false;
        }
        first = true;
    }

    draw_data.midx = (maxx+minx) / 2;
    draw_data.midy = (maxy+miny) / 2;
    //ctx.rect(minx-draw_data.midx,miny-draw_data.midy,maxx-minx,maxy-miny);
    // ctx.moveTo(1000,0);
    // ctx.lineTo(0,0);
    // ctx.lineTo(0,1000);

    return [minx,miny,maxx,maxy];
}

function draw_arc(ctx:CanvasRenderingContext2D,name){
    var x = 0;
    var y = 0;
    var r = 20;
    ctx.arc(x+r/2,y+r/2,r,0, 2 * Math.PI);
    ctx.moveTo(r/2,r+8);
    ctx.lineTo(r/2,r+28);
    //draw_port(ctx,{x:x,y:y,w:r,h:r},12);
    ctx.fillStyle = "gray";
    ctx.fillText(name,x+r/4-r/2,y+r);
}

var pin_alias = {};

spice_model_draw['PIN'] = function(ctx:CanvasRenderingContext2D,m:model){
    //const ctx:CanvasRenderingContext2D = canvas.getContext("2d");
    // ctx.save();
    // ctx.scale(0.5,0.5);
    // draw_array(ctx,npn_data);
    // ctx.restore();

    //别名处理
    var name = m.def[m.pin+2];
    name = pin_alias[name] || name;
    draw_arc(ctx,name);
    //console.log(m);
}

spice_model_draw['_NPN_'] = function(ctx:CanvasRenderingContext2D){
    //const ctx:CanvasRenderingContext2D = canvas.getContext("2d");
    ctx.save();
    ctx.scale(0.5,0.5);
    draw_array(ctx,npn_data);
    ctx.restore();
}

spice_model_draw['_PNP_'] = function(ctx:CanvasRenderingContext2D){
    //const ctx:CanvasRenderingContext2D = canvas.getContext("2d");
    ctx.save();
    ctx.scale(0.5,0.5);
    draw_array(ctx,pnp_data);
    ctx.restore();
}

spice_model_draw['_NMOS_'] = function(ctx:CanvasRenderingContext2D){
    //const ctx:CanvasRenderingContext2D = canvas.getContext("2d");
    ctx.save();
    ctx.scale(0.5,0.5);
    draw_array(ctx,nmos_data);
    ctx.restore();
}

spice_model_draw['_PMOS_'] = function(ctx:CanvasRenderingContext2D){
    //const ctx:CanvasRenderingContext2D = canvas.getContext("2d");
    ctx.save();
    ctx.scale(0.5,0.5);
    draw_array(ctx,pmos_data);
    ctx.restore();
}

spice_model_draw['_VDMOS_'] = function(ctx:CanvasRenderingContext2D){
    //const ctx:CanvasRenderingContext2D = canvas.getContext("2d");
}

spice_model_draw['_BLACK_BOX_'] = function(ctx:CanvasRenderingContext2D){
    //绘制黑盒
}

var spice_model_port_num = {
    R:2,        //电阻
    C:2,        //电容
    L:2,        //电感
    D:2,        //二极管
    // G:4,        //线性电压控制电流源  n+ n- nc+ nc- VALUE <m=val>
    // E:4,        //线性电压控制电压源  n+ n- nc+ nc- VALUE
    // F:4,        //线性电流控制电流源  n+ n- VNAM VALUE <m=val>
    // H:4,        //线性电流控制电压源  n+ n- VNAM VALUE
    G:2,
    E:2,
    // F:2,
    // H:2,
    VCCS:4,         //G
    VCVS:4,         //E
    CCCS:4,         //F
    CCVS:4,         //H
    I:2,
    V:2,
    _NMOS_:3,   //d g s b
    _PMOS_:3,   //d g s b
    _NPN_:3,    //c b e s
    _PNP_:3,    //c b e s
};

var spice_model_port_pos = {
    R:[[0,-20],[0,18]],
    C:[[0,-18],[0,18]],

    L:[[0,-24],[0,22]],
    D:[[5,-10],[5,20]],
    A:[[5,-12],[5,23]],
    V:[[0,-25],[0,23]],
    I:[[0,-25],[0,23]],

    G:   [[0,-18],[0,17],[-18,0],[17,0]],
    E:   [[0,-18],[0,17],[-18,0],[17,0]],
    VCCS:[[0,-23],[0,22],[-18,0],[17,0]],
    VCVS:[[0,-18],[0,17],[-18,0],[17,0]],
    CCCS:[[0,-18],[0,17],[-18,0],[17,0]],
    CCVS:[[0,-18],[0,17],[-18,0],[17,0]],

    PIN:[[8,49]],
    _NPN_:[
        [24,-42],     //c
        [-27,0 ],     //b
        [24, 40],     //e
    ],
    _PNP_:[
        [24,-42],     //c
        [-26,0],     //b
        [24,42],     //e
    ],
    _PMOS_:[
        [6,-46],      //d
        [-24,14],      //g
        [ 6,44],     //s
    ],
    _NMOS_:[
        [6,-45],      //d
        [-25,16],      //g
        [6,44],       //s
    ]
};

var spice_model_port_pos_hflip = {
    _NPN_:[
        [-26,-42],     //c
        [ 25,0  ],     //b
        [-26, 40],     //e
    ],
    _PNP_:[
        [-26,-42],     //c
        [25 ,0],      //b
        [-26,42],     //e
    ],
    _PMOS_:[
        [-8 ,-46],      //d
        [24 ,14],      //g
        [ -8,44 ],     //s
    ],
    _NMOS_:[
        [-8,-45],      //d
        [23,16],      //g
        [-8,44],       //s
    ]
};


var spice_model_port_pos_vflip = {
    R:[[0,18],[0,-20]],
    C:[[0,18],[0,-18]],

    //L:[[3,4],[3,-40]],

    V:[[5,11],[5,-23]],
    I:[[5,11],[5,-23]],
    A:[[5,11],[5,-23]],

    D:[[5,8],[5,-19]],

    PIN:[[8,-48]],


    VCCS:[[0,22],[0,-23],[-18,0],[17,0]],
    VCVS:[[0,17],[0,-18],[-18,0],[17,0]],
    CCCS:[[0,17],[0,-18],[-18,0],[17,0]],
    CCVS:[[0,17],[0,-18],[-18,0],[17,0]],

    _NPN_:[
        [26, 40],     //c
        [-26,0  ],     //b
        [26,-42],     //e
    ],
    _PNP_:[
        [26,42],     //c
        [-26 ,0],      //b
        [26,-42],    //e
    ],
    _PMOS_:[
        [8,44 ],      //d
        [-26,-16],      //g
        [8,-46],      //s
    ],
    _NMOS_:[
        [8,44],       //d
        [-24,-16],      //g
        [8,-45],      //s
    ]
};

var spice_model_port_pos_vhflip = {
    _NPN_:[
        [-26, 40],     //c
        [ 25,0  ],     //b
        [-26,-42],     //e
    ],
    _PNP_:[
        [-26,42],     //c
        [ 25,0  ],     //b
        [-26,-42],    //e
    ],
    _PMOS_:[
        [ -8,44 ],      //d
        [24 ,-16],      //g
        [-8 ,-46],      //s
    ],
    _NMOS_:[
        [-8,44],       //d
        [24,-16],      //g
        [-8,-45],      //s
    ]
};

var spice_model_port_info = {
    0b00:spice_model_port_pos,
    0b01:spice_model_port_pos_hflip,
    0b10:spice_model_port_pos_vflip,
    0b11:spice_model_port_pos_vhflip
};

var G_data = [
    [
        0,0,
        20,0,
        20,20,
        0, 20,
        0 ,0,
    ],
    [
        10 ,-8,
        10 , 0,
    ],
    [
        10, 20,
        10, 28,
    ]
];


var VCCS_data = [
    [
        0,0,
        20,0,
        20,20,
        0, 20,
        0 ,0,
    ],
    [10 , -13, 10 , 0 ,],        //上
    [10 , 20, 10 , 33,],        //下
    [-8 , 10, 0  , 10,],        //左
    [20 , 10, 28 , 10,]         //右
];

function rect_to_line(x,y,w,h){
    return [
        x,y,
        x+w,y,
        x+w,y+h,
        x,y+h,
        x,y
    ];
}

var R_data = [
    rect_to_line(0,0,10,20),
    [5,0,5,-8],
    [5,20,5,28]
];

var C_data = [
    [0,0,20,0],
    [0,5,20,5],
    [10,0,10,-15],
    [10,5,10,20]
];

var L_data = [
    [0,0,0,-8],
    [0,38,0,30]
];

var I_data = [
    [0,0,0,-8],
    [0,38,0,30]
];


var spice_model_data = {
    R:R_data,
    C:C_data,
};


function draw_port(ctx:CanvasRenderingContext2D,rect:any,port_len?:number|undefined){
    port_len = port_len || 8;
    ctx.moveTo(rect.w/2,0);
    ctx.lineTo(rect.w/2,-port_len);
    ctx.moveTo(rect.w/2,rect.h);
    ctx.lineTo(rect.w/2,rect.h+port_len);
}

enum DIR{
    down,
    up,
    right,
    left
};

function draw_arrow(ctx:CanvasRenderingContext2D,x:number,y:number,dir:DIR){
    if(dir==DIR.down){
        ctx.moveTo(x-5,y-5);
        ctx.lineTo(x  ,y);
        ctx.lineTo(x+5,y-5);
    }
    else if(dir==DIR.up){
        ctx.moveTo(x-5,y+5);
        ctx.lineTo(x  ,y);
        ctx.lineTo(x+5,y+5);
    }
}

spice_model_draw['L'] = function(ctx:CanvasRenderingContext2D){
    var x = 0;
    var y = -16;
    var r = 5;
    ctx.arc(x+r/2,5 + y       ,r,Math.PI/2*3,Math.PI/2,true);
    ctx.arc(x+r/2,5 + y+r*2*1 ,r,Math.PI/2*3,Math.PI/2,true);
    ctx.arc(x+r/2,5 + y+r*2*2 ,r, Math.PI/2*3,Math.PI/2,true);
    //ctx.arc(x+r/2,y+r*2*3 ,r, Math.PI/2*3,Math.PI/2,true);

    draw_array_coord(ctx,L_data);
    //draw_port(ctx,{x:x,y:y-8,w:r,h:r*2*3},8);
}

//电阻
spice_model_draw["R"] = function(ctx:CanvasRenderingContext2D){
    // var rect = {x:0,y:0,w:10,h:20};
    // ctx.rect(rect.x,rect.y,rect.w,rect.h);
    // draw_port(ctx,rect);            //绘制端口
    draw_array_coord(ctx,R_data);
}

//电容
spice_model_draw["C"] = function(ctx:CanvasRenderingContext2D){
    var rect = {x:0,y:0,w:20,h:5};

    //  -||-
    // ctx.moveTo(0,0);
    // ctx.lineTo(rect.w,0);

    // ctx.moveTo(0,       rect.h);
    // ctx.lineTo(rect.w,  rect.h);

    // draw_port(ctx,rect);            //绘制端口
    draw_array_coord(ctx,C_data);
}

//电流源
spice_model_draw["I"] = function(ctx:CanvasRenderingContext2D){
    var x = -7;
    var y = -8;
    var r = 14;
    ctx.arc(x + r / 2, y + r / 2, r, 0, 2 * Math.PI);
    //draw_port(ctx,{x:x,y:y,w:r,h:r},12);
    draw_array_coord(ctx, I_data);
    ctx.fillStyle = "gray";
    ctx.fillText("A", x + r / 4 - 1, y + r);
    draw_arrow(ctx, 0, 20, DIR.down);
}

spice_model_draw['V'] = function(ctx:CanvasRenderingContext2D){
    var x = -7;
    var y = -8;
    var r = 14;
    ctx.arc(x + r / 2, y + r / 2, r, 0, 2 * Math.PI);
    //draw_port(ctx,{x:x,y:y,w:r,h:r},12);
    draw_array_coord(ctx, I_data);
    ctx.fillStyle = "gray";
    ctx.fillText("V", x + r / 4 - 1, y + r);
    draw_arrow(ctx, 0, 20, DIR.down);
}

spice_model_draw['D'] = function(ctx:CanvasRenderingContext2D){
    //
    var rect = {x:0,y:0,w:10,h:10};
    ctx.moveTo(0,0);
    ctx.lineTo(rect.w,0);
    ctx.lineTo(rect.w/2,rect.h);
    ctx.lineTo(0,0);

    ctx.moveTo(0,rect.h);
    ctx.lineTo(rect.w,rect.h);

    ctx.moveTo(rect.w/2,-10);
    ctx.lineTo(rect.w/2,rect.y+rect.h+10);
}

spice_model_draw['G'] = function(ctx:CanvasRenderingContext2D){
    draw_array_coord(ctx,G_data);
    ctx.fillText("+",0,0);
    ctx.fillText("-",0,0);
}

spice_model_draw['E'] = function(ctx:CanvasRenderingContext2D){
    draw_array_coord(ctx,G_data);
    ctx.fillText("+",0,0);
    ctx.fillText("-",0,0);
}

spice_model_draw['F'] = function(ctx:CanvasRenderingContext2D){
    draw_array_coord(ctx,G_data);
}

spice_model_draw['H'] = function(ctx:CanvasRenderingContext2D){
    draw_array_coord(ctx,G_data);
}

spice_model_draw['VCCS'] = function(ctx:CanvasRenderingContext2D){
    //G
    draw_array_coord(ctx,VCCS_data);
    ctx.fillStyle = "gray";
    ctx.fillText("+",-20,-5);
    ctx.fillText("-",15,-5);
    ctx.fillText("V>C",-10,3);
    draw_arrow(ctx,0,18,DIR.down);
}

spice_model_draw['VCVS'] = function(ctx:CanvasRenderingContext2D){
    //E
    draw_array_coord(ctx,VCCS_data);
    ctx.fillStyle = "gray";
    ctx.fillText("+",-20,-5);
    ctx.fillText("-",15,-5);
    ctx.fillText("V>V",-10,3);
    draw_arrow(ctx,0,18,DIR.down);
}

spice_model_draw['CCCS'] = function(ctx:CanvasRenderingContext2D){
    //F
    draw_array_coord(ctx,VCCS_data);
    ctx.fillStyle = "gray";
    ctx.fillText("+",-20,-5);
    ctx.fillText("-",15,-5);
    ctx.fillText("C>C",-10,3);
    draw_arrow(ctx,0,18,DIR.down);
}

spice_model_draw['CCVS'] = function(ctx:CanvasRenderingContext2D){
    //H
    draw_array_coord(ctx,VCCS_data);
    ctx.fillStyle = "gray";
    ctx.fillText("+",-20,-5);
    ctx.fillText("-",15,-5);
    ctx.fillText("C>V",-10,3);
    draw_arrow(ctx,0,18,DIR.down);
}

var base_draw_x = 20;
var base_draw_y = 20;

function base_draw_init(){
    base_draw_x = 20;
    base_draw_y = 20;
}

function next_draw_row(){
    base_draw_x = 20;
    base_draw_y += 200;
}

function next_draw_col(){
    base_draw_x += 100;
    if(base_draw_x>=1800){
        next_draw_row();
    }
}


function process_netlist(model_code:string){
    base_draw_init();
    var _add_rep = /\n\s+\+/g;          //替换换行符
    model_code = model_code.replace(_add_rep,'');
    var lines =  model_code.split('\n');
    for (let i = 0; i < lines.length; i++) {
        const element = lines[i].trim();
        if(element.substr(0,1)=='*'){
            //注释,或者其他信号
            var alias_rp = (/@(\d+):([^\s]+)/g);
            var match = null;
            while((match=alias_rp.exec(element))){
                pin_alias[match[1]] = match[2];
            }
        }
        else{
            //
            var def = element.split(' ');
            var name = def[1];
            var base = def[2];
            if(def[0].toUpperCase()=='.SUBCKT'){
                //定义子电路
            }
            else if(def[0].toUpperCase()=='.MODEL'){
                //定义模块
                MODEL[name] = base;

                //替换,
                /*
                如          Q2in 6 2 15 @QIN
                替换成      Q2in 6 2 15 @PNP
                */
                model_code = (model_code + ' ').replace(new RegExp("\\s+"+name+"[ \t]+","g"),' @'+base+' ');
            }
        }
    }
    lines = model_code.split('\n');

    //
    var model_list:model[] = [];

    for (let i = 0; i < lines.length; i++) {
        const element = lines[i].trim();
        if(element.substr(0,1)=='*'){
            //注释
        }
        else{
            var def = element.split(/\s+/g);

            var ID = def[0].substr(0,1).toUpperCase();
            if(def[0].toUpperCase()=='.SUBCKT'){
                //定义子电路
                var name = def[1];

                for (let i = 2; i < def.length; i++) {
                    const element = def[i];
                    var m = new model();
                    m.set_subckt(name);
                    m.str = element;
                    m.def = def;
                    m.pin = i-2;
                    model_list.push(m);
                }

                next_draw_row();            //下一行

            }
            else if(def.length<=1){}        //
            else if(def[0].toUpperCase()=='.MODEL'){

            }
            else{

                var m = new model();
                model_list.push(m);
                //
                m.def = def;
                m.str = element;
                if(spice_model_draw[ID]){
                    //基础单元
                    m.name = ID;
                    if(m.name=='G'||m.name=='E'){
                        //VCCS,VCVS
                        if(element.indexOf('=')<0){
                            m.name = m.name=='G'?'VCCS':'VCVS';
                        }
                        else{
                            /*
                            VALUE =
                            CUR =
                            TABLE =
                            VOL =
                            */
                        }
                    }
                }
                else{
                    var extID = element.match(/@\w+/).toString();
                    //非基础单元
                    extID = extID.toString().replace('@','');
                    var extID_name = '_' + extID + '_';
                    m.name = extID_name;
                    m.isbase = false;
                }
            }
        }
    }

    return model_list;
}

function draw_demo(){
    const canvas:any = document.getElementById("canvas");
    var ctx:CanvasRenderingContext2D = canvas.getContext("2d");
    ctx.lineWidth = 1.5;
    ctx.strokeStyle = 'gray';
    // create the path
    ctx.save();
    ctx.translate(50,50);
    ctx.beginPath();
    if(false){
        //绘制简单的线
        ctx.moveTo (50,25);   ctx.lineTo (50,75);    // first vertical line
        ctx.moveTo (100,25);  ctx.lineTo (100,75);   // second vertical line
        ctx.moveTo (150,25);  ctx.lineTo (150,75);   // third vertical line
    }
    else{
        var x = 0;
        ctx.translate(150,0); x+=1; spice_model_draw['R'](ctx);
        ctx.translate(150,0); x+=1; spice_model_draw['C'](ctx);
        ctx.translate(150,0); x+=1; spice_model_draw['I'](ctx);
        ctx.translate(150,0); x+=1; spice_model_draw['L'](ctx);
        ctx.translate(150,0); x+=1; spice_model_draw['D'](ctx);
        //ctx.scale(0.5,0.5);
        ctx.translate(150,0); x+=1; spice_model_draw['_NMOS_'](ctx);
        ctx.translate(150,0); x+=1; spice_model_draw['_PMOS_'](ctx);
        ctx.translate(150,0); x+=1; spice_model_draw['_NPN_'](ctx);
        ctx.translate(150,0); x+=1; spice_model_draw['G'](ctx);
        ctx.translate(150,0); x+=1; spice_model_draw['_PNP_'](ctx);
    }
    ctx.stroke();
    ctx.restore();
}

function draw_element(ctx:CanvasRenderingContext2D,m:model,index:number,select:any){
    ctx.save();
    var draw_x =  m.draw_x*m.scale();
    var draw_y =  m.draw_y*m.scale();
    var mouseclick_map = window['mouseclick_map'] || {};
    for (let x = 0; x < 40; x++) {
        for (let y = 0; y < 40; y++) {
            var mm = mouseclick_map[x+draw_x] || {};
            mouseclick_map[x+draw_x] = mm;
            mm[y+draw_y] = index;
        }
    }
    window['mouseclick_map'] = mouseclick_map;

    ctx.translate(draw_x,draw_y);
    ctx.beginPath();
    //console.log(m.name,m.draw_x,m.draw_y);
    select = select || -1;
    if(select.toString()==index.toString()){
        console.log(select,index);
        ctx.strokeStyle = 'red';
        window['select_element'] = m;
        var n:any = document.getElementById('alias');
        n.value = m.str;
    }
    else{
        ctx.strokeStyle = 'gray';
    }
    var func = spice_model_draw[m.name] || (()=>{});
    var xscale = 1.0;
    var yscale = 1.0;
    if(m.hflip) xscale = -xscale;
    if(m.vflip) yscale = -yscale;


    ctx.rotate(Math.PI*m.rotate);
    ctx.scale(xscale,yscale);

    func(ctx,m);
    //ctx.scale(1,1);
    ctx.stroke();
    ctx.restore();
}

function get_draw_netlist(list:model[]){
    var netlist_map = {};
    for (let i = 0; i < list.length; i++) {
        const element = list[i];
        var name = element.name;
        if(name=='PIN'){
            //导出外部的名称
            //for (let i = 0; i < element.def.length-2; i++) {
                var net_name = element.str;
                var nets:[any] = netlist_map[net_name] || [];
                netlist_map[net_name] = nets;
                nets.push([i,element]);
            //}
        }
        else{
            var port_num = spice_model_port_num[name];
            for (let p = 0; p < port_num; p++) {
                var net_name = element.get_port(p);
                var nets:[any] = netlist_map[net_name] || [];
                netlist_map[net_name] = nets;
                nets.push([p,element]);
            }
        }
    }
    return netlist_map;
}

function process_draw_list(list,select:any){
    const canvas:any = document.getElementById("canvas");
    var ctx:CanvasRenderingContext2D = canvas.getContext("2d");
    ctx.setTransform(1, 0, 0, 1, 0, 0);


    ctx.clearRect(0,0,1920,800);
    ctx.lineWidth = 1.5;
    ctx.strokeStyle = 'gray';
    for (let i = 0; i < list.length; i++) {
        const element = list[i];
        draw_element(ctx,element,i,select);
    }
    ctx.stroke();
}

function process_draw_net(netlist_map:any){
    const canvas:any = document.getElementById("canvas");
    var ctx:CanvasRenderingContext2D = canvas.getContext("2d");
    ctx.strokeStyle = 'blue';
    ctx.lineWidth = 3;
    ctx.beginPath();
    for (const key in netlist_map) {
        var first = true;
        if (netlist_map.hasOwnProperty(key)) {
            const element:[any] = netlist_map[key];
            //查找网络上的所有元器件
            element.forEach((e:[number,model],i)=>{
                var x = e[1].scale() * e[1].draw_x;
                var y = e[1].scale() * e[1].draw_y;

                var port = e[0];
                if(e[1].name=='PIN'){
                    port = 0;
                }

                //console.log(e[1].name);
                var flip = 0;
                if(e[1].hflip) flip |= 1;
                if(e[1].vflip) flip |= 2;
                var pos = spice_model_port_pos[e[1].name];
                if(flip!=0){
                    var info = spice_model_port_info[flip]
                    pos = info[e[1].name] || pos;
                }


                var offx = pos[port][0];
                var offy = pos[port][1];

                //旋转转换端口位置

                var rotate = e[1].rotate;
                if(rotate>0.4){
                    var rx = offx * Math.cos(rotate * Math.PI) - offy * Math.sin((rotate) * Math.PI);
                    var ry = offx * Math.sin(rotate * Math.PI) + offy * Math.cos((rotate) * Math.PI);
                    offx = rx;
                    offy = ry;
                }

                if(first)
                    ctx.moveTo(x + offx,y + offy);
                else
                    ctx.lineTo(x + offx,y + offy);

                first = false;
            });
        }
    }

    ctx.stroke();
}

function process_code(){
    var textarea:any = document.getElementById('code');
    var code = textarea.value;
    var list =  process_netlist(code);

    process_draw_list(list,window['select_index']);
    window["netlist_map"] = get_draw_netlist(list);
    process_draw_net(window["netlist_map"]);

    return list;
}
